package com.qiyu.common.utils;

import org.apache.commons.codec.digest.DigestUtils;

/**
 * @author idea
 * @data 2020/3/14
 */
public class Md5Util {


    /**
     * MD5方法
     *
     * @param text 明文
     * @return 密文
     * @throws Exception
     */
    public static String md5(String text) throws Exception {
        //加密后的字符串
        String encodeStr=DigestUtils.md5Hex(text );
        System.out.println("MD5加密后的字符串为:encodeStr="+encodeStr);
        return encodeStr;
    }

//
//    // 测试主函数
//    public static void main(String args[]) throws Exception {
//        String t2="appid=wx52be552025a59c87&body=测试描述信息&mch_id=1579446481&nonce_str=B2052103835846CABBDEE4F7F0861F6D&notify_url=http://127.0.0.1/qiyu/test/paySuccess&openid=otjIL490mty9RzrbQc2bcZul_cvM&out_trade_no=SO1584179332800&spbill_create_ip=127.0.0.1&time_start=20200314174852&total_fee=1&trade_type=JSAPI&key=qy888jknaszxco1223as8dasc12saas0";
//       String text="appid=wx52be552025a59c87&attach=this is test param&body=测试描述信息&mch_id=1579446481&nonce_str=B2052103835846CABBDEE4F7F0861F6D&notify_url=http://127.0.0.1/qiyu/test/paySuccess&openid=otjIL490mty9RzrbQc2bcZul_cvM&out_trade_no=SO1584179332800&spbill_create_ip=127.0.0.1&time_start=20200314174852&total_fee=1&trade_type=JSAPI&key=qy888jknaszxco1223as8dasc12saas0";
//       String reuslt = md5(text);
//       System.out.println(reuslt);
//       System.out.println(md5(t2));
//    }

}
